var t = require;
var e = module;
var o = exports;
var n =
    (this && this.__extends) ||
    (function() {
        var t = function(e, o) {
            return (t =
                Object.setPrototypeOf ||
                ({ __proto__: [] }
                    instanceof Array &&
                    function(t, e) {
                        t.__proto__ = e;
                    }) ||
                function(t, e) {
                    for (var o in e) e.hasOwnProperty(o) && (t[o] = e[o]);
                })(e, o);
        };
        return function(e, o) {
            function n() {
                this.constructor = e;
            }
            t(e, o), (e.prototype = null === o ? Object.create(o) : ((n.prototype = o.prototype), new n()));
        };
    })(),
    r =
    (this && this.__decorate) ||
    function(t, e, o, n) {
        var r,
            a = arguments.length,
            i = a < 3 ? e : null === n ? (n = Object.getOwnPropertyDescriptor(e, o)) : n;
        if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) i = Reflect.decorate(t, e, o, n);
        else
            for (var s = t.length - 1; s >= 0; s--)
                (r = t[s]) && (i = (a < 3 ? r(i) : a > 3 ? r(e, o, i) : r(e, o)) || i);
        return a > 3 && i && Object.defineProperty(e, o, i), i;
    };
Object.defineProperty(o, "__esModule", { value: !0 });
var a = t("BootConst"),
    i = t("EventData"),
    s = t("GameData"),
    c = t("GlodFly"),
    l = t("View"),
    u = t("ZSFly"),
    p = t("Platforms"),
    f = t("Prefabs"),
    d = t("Sounds"),
    h = t("WatchVideo"),
    y = t("ConfS"),
    g = t("fun"),
    v = t("guide"),
    m = t("pause"),
    _ = t("telepole"),
    A = t("topBar"),
    b = require("./回血视频提示框"),
    C = t("fightManager"),
    w = cc._decorator,
    O = w.ccclass,
    P =
    (w.property,
        (function(t) {
            function e() {
                var e = (null !== t && t.apply(this, arguments)) || this;
                return (
                    (e.res = "fightView"),
                    (e.isDestroy = !0),
                    (e.myrank = new i.default(1)),
                    (e.jb = new i.default(0)),
                    (e.zs = new i.default(0)),
                    e
                );
            }
            return (
                n(e, t),
                (e.prototype.view_jb = function(t, e) {
                    t.set(1, e), (this.jbsf = t.icon);
                }),
                (e.prototype.view_zs = function(t, e) {
                    t.set(0, e), (this.zssf = t.icon);
                }),
                (e.prototype.add = function(t, e, o, n) {
                    if (1 == t) {
                        var r = this.jbsf.node.convertToWorldSpaceAR(cc.v2(0, 0));
                        (r = cc.Canvas.instance.node.convertToNodeSpaceAR(r)),
                        c.default.show1(o, n, r.x, r.y),
                            (this.jb.value += e);
                    } else {
                        r = this.zssf.node.convertToWorldSpaceAR(cc.v2(0, 0));
                        (r = cc.Canvas.instance.node.convertToNodeSpaceAR(r)),
                        u.default.show1(o, n, r.x, r.y),
                            (this.zs.value += e);
                    }
                }),
                (e.prototype.onEnable = function() {
                    this.hideView(A.default);
                    var t = f.instantiate("fight");
                    (t.zIndex = -1), (t.parent = cc.Canvas.instance.node), (C.default.inst.view = this);
                    var e = this.find("telepole");
                    if (
                        ((this.telepole = e.getComponent(_.default)),
                            (this.telepole.handle.component = "fightManager"),
                            (this.telepole.handle.target = t),
                            (this.telepole.handle.handler = "TelepoleEvent"),
                            (this.find("02").active = C.default.ispvp),
                            (this.find("回血视频").active = !C.default.ispvp),
                            C.default.inst.所有人的分数和状态.on(this, this.on所有人的分数和状态, C.default.ispvp),
                            C.default.ispvp)
                    ) {
                        if (null == (o = y.DatasManager.HeroDatasById[s.default.hero])) return;
                        p.default.platformCtrl.dd(a.dd.PVPStart, {
                            eventTime: Date.now(),
                            currentHeroID: s.default.hero,
                            currentLV: g.getHeroLv(s.default.hero),
                            currentEquip1: s.default.equips.includes(o.equipids[0]),
                            currentEquip2: s.default.equips.includes(o.equipids[1]),
                            currentEquip3: s.default.equips.includes(o.equipids[2]),
                            currentSkill1LV: g.getSkillLv(o.skills[0]),
                            currentSkill2LV: g.getSkillLv(o.skills[1]),
                            currentSkill3LV: g.getSkillLv(o.skills[2])
                        });
                    } else {
                        var o;
                        if (null == (o = y.DatasManager.HeroDatasById[s.default.hero])) return;
                        p.default.platformCtrl.dd(a.dd.StageStart, {
                            eventTime: Date.now(),
                            StageID: C.default.fubendata.ID,
                            StagePass: s.default.fubens.includes(C.default.fubendata.ID),
                            currentHeroID: s.default.hero,
                            currentLV: g.getHeroLv(s.default.hero),
                            currentEquip1: s.default.equips.includes(o.equipids[0]),
                            currentEquip2: s.default.equips.includes(o.equipids[1]),
                            currentEquip3: s.default.equips.includes(o.equipids[2]),
                            currentSkill1LV: g.getSkillLv(o.skills[0]),
                            currentSkill2LV: g.getSkillLv(o.skills[1]),
                            currentSkill3LV: g.getSkillLv(o.skills[2])
                        });
                    }
                    d.Sounds.playMusic("战斗场景");
                    var n = !1;
                    C.default.playerdata.herodata.skills.forEach(function(t) {
                            var e = y.DatasManager.SkillDatasById[t];
                            C.default.playerdata.equips.includes(e.CoinNeed) || (n = !0);
                        }),
                        (this.find("解锁技能").active = n);
                }),
                (e.prototype.onDisable = function() {
                    C.default.inst.所有人的分数和状态.off(this, this.on所有人的分数和状态),
                        C.default.inst.node.destroy();
                }),
                (e.prototype.on所有人的分数和状态 = function() {
                    for (var t = C.default.inst.所有人的分数和状态.value, e = 0; e < t.length; e++) {
                        if (t[e].isplayer) return void(this.myrank.value = e);
                    }
                }),
                (e.prototype.view_myrank = function(t, e) {
                    t.string = "" + (e + 1);
                }),
                (e.prototype.onClick = function(t) {
                    var e = this;
                    switch (t) {
                        case "attack":
                            C.default.inst.on_player_attack();
                            break;
                        case "skill0":
                            C.default.inst.on_player_skill(0);
                            break;
                        case "skill1":
                            C.default.inst.on_player_skill(1);
                            break;
                        case "skill2":
                            C.default.inst.on_player_skill(2);
                            break;
                        case "pause":
                            v.default.isRuning || this.showView(m.default);
                            break;
                        case "回血视频":
                            (C.default.inst.speed.value = 0),
                            this.showView(b.default).set(
                                this,
                                function() {
                                    h.default.show(
                                        a.dd.fightView,
                                        function() {
                                            (C.default.inst.speed.value = 1),
                                            (C.default.inst.player.hp.value =
                                                C.default.inst.player.maxhp.value),
                                            C.default.inst.player.addmp(100);
                                        },
                                        function() {
                                            C.default.inst.speed.value = 1;
                                        }
                                    );
                                },
                                function() {
                                    C.default.inst.speed.value = 1;
                                }
                            );
                            break;
                        case "解锁技能":
                            (C.default.inst.speed.value = 0),
                            h.default.show(
                                a.dd.fightView,
                                function() {
                                    (C.default.inst.speed.value = 1),
                                    cc.Canvas.instance.node.emit("看视频解锁技能"),
                                        (e.find("解锁技能").active = !1);
                                },
                                function() {
                                    C.default.inst.speed.value = 1;
                                }
                            );
                    }
                }),
                (e = r([O], e))
            );
        })(l.default));
o.default = P;